from http.server import HTTPServer, BaseHTTPRequestHandler
import json, subprocess
from share import *
 
class Resquest(BaseHTTPRequestHandler):
  def do_GET(self):
    self.send_response(200)
    self.send_header('Content-type', 'application/json')
    self.send_header('Access-Control-Allow-Origin', '*')
    self.end_headers()

    all_tx = get_all_data()
    data = {'result': all_tx}
    self.wfile.write(json.dumps(data).encode())
 
def start_serve_data():
  host = ('0.0.0.0', 8888)
  server = HTTPServer(host, Resquest)
  server.serve_forever()